﻿<UserControl x:Class="TaskManager.View.TaskView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" d:DesignWidth="200">

    <Border CornerRadius="5" BorderThickness="1" BorderBrush="#FF1D1D1D">
        <Border.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="-90" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF878484" Offset="0.7"/>
                <GradientStop Color="#FF2C2CB6" Offset="1"/>
            </LinearGradientBrush>
        </Border.Background>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <StackPanel Orientation="Vertical" Margin="10,5">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Name}" HorizontalAlignment="Left" TextTrimming="CharacterEllipsis" Foreground="White" />
                    <TextBlock Text="{Binding Percent, StringFormat=' - {0}%'}" HorizontalAlignment="Left" TextTrimming="CharacterEllipsis" Foreground="White"
                              Visibility="{Binding Percent, Converter={StaticResource NullToVisibilityConverter}}" />
                </StackPanel>

                <ProgressBar Margin="5,3,5,0" IsIndeterminate="{Binding IsIndeterminate}" Value="{Binding Percent}" Height="10" Foreground="#FFF3AB6F" />
            </StackPanel>

            <StackPanel Orientation="Horizontal" Grid.Column="1">
                <Button Visibility="{Binding IsCancelPossible, Converter={StaticResource BoolToVisibilityConverter}}"
                        Command="{Binding CancelCommand}" Style="{StaticResource CancelButtonStyle}" 
                        Margin="0,5,10,0" VerticalAlignment="Top" ToolTip="Cancel" />
            </StackPanel>
        </Grid>
    </Border>
</UserControl>
